<?php
header('content-type:text/html;charset=utf-8;');
$conn=mysqli_connect('127.0.0.1','root','root','user');
$u=$_POST['un'];
$p=$_POST['pw'];
    $sql="SELECT * FROM userinfo WHERE username='$u' AND `password`='$p'";
    //执行sql语句，并放回结果集
    $result=mysqli_query($conn,$sql);
    if($row=mysqli_fetch_row($result)){
        echo 1;
    }else{
        echo 0;
    }
    // 关闭数据库
    mysqli_close($link);
?>